Skip to content

ts_time: make Handle an actually strong handle that cancels on drop - #385

Merged
danderson merged 1 commit into
mainfrom
push-nnulzxulrozl
Aug 26, 2026
Merged

ts_time: make Handle an actually strong handle that cancels on drop#385
danderson merged 1 commit into
mainfrom
push-nnulzxulrozl

Conversation

@danderson

Copy link
Copy Markdown
Member

You can now forget() a handle to drop the Handle without canceling the event (at which point the event will fire unconditionally when its time is up). You can also Scheduler::add_uncancelable as a more obvious version of add(...).forget().

Also remove reschedule(), since it's hard to use ergonomically and has no performance benefit over just canceling and adding a new event.

Change-Id: Icc5e025e8b0ea4f81ca822c9177ecd3e6a6a6964

You can now forget() a handle to drop the Handle without canceling the event
(at which point the event will fire unconditionally when its time is up).
You can also Scheduler::add_uncancelable as a more obvious version of
add(...).forget().

Also remove reschedule(), since it's hard to use ergonomically and has no
performance benefit over just canceling and adding a new event.

Signed-off-by: David Anderson <danderson@tailscale.com>
Change-Id: Icc5e025e8b0ea4f81ca822c9177ecd3e6a6a6964

@npry npry left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, i like this refactor

@danderson
danderson merged commit bc79619 into main Aug 26, 2026
23 checks passed
@danderson
danderson deleted the push-nnulzxulrozl branch August 26, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants